using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Calendar_Notice - 日常安排通知列表 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class ICalendarNotice<T> :ModelBase<CalendarNotice> where T : CalendarNotice, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.NoticeId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return NoticeId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.NoticeId=dy.NoticeId;
           this.DayId=dy.DayId;
           this.Type=dy.Type;
           this.Advance=dy.Advance;
           this.Version=dy.Version;
        } 

        #region 定义属性

     
         /// <summary>
        /// 日常安排通知列表
        /// </summary>
        private String _NoticeId = "";
      
        /// <summary>
        /// 日常安排通知列表
        /// </summary>
        public String NoticeId
        {
            get 
            {
              return   (this._NoticeId); 
            }

            set 
            {
                    _NoticeId= value;  
            }
        }
       
     
         /// <summary>
        /// 日常安排ID
        /// </summary>
        private String _DayId = "";
      
        /// <summary>
        /// 日常安排ID
        /// </summary>
        public String DayId
        {
            get 
            {
              return   (this._DayId); 
            }

            set 
            {
                    _DayId= value;  
            }
        }
       
     
         /// <summary>
        /// 通知类型
        /// </summary>
        private int _Type =-1;
      
        /// <summary>
        /// 通知类型
        /// </summary>
        public yq.Enums.CalendarNotice.Type Type
        {
            get 
            {
              return   (yq.Enums.CalendarNotice.Type)this._Type;  
            }

            set 
            {
                    _Type= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 通知提前时间
        /// </summary>
        private int _Advance =int.MinValue;
      
        /// <summary>
        /// 通知提前时间
        /// </summary>
        public int Advance
        {
            get 
            {
              return   (this._Advance); 
            }

            set 
            {
                    _Advance= value;  
            }
        }
       
     
      

      #endregion 定义属性 

          protected internal override void SetValue(CalendarNotice info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["NoticeId"]!= DBNull.Value)
                  {
                  info.NoticeId=row["NoticeId"].ToString();
                 }
                 
                  
                  if(row["DayId"]!= DBNull.Value)
                  {
                  info.DayId=row["DayId"].ToString();
                 }
                 
                  
                  if(row["Type"]!= DBNull.Value)
                  {
                  info.Type=  (yq.Enums.CalendarNotice.Type)(row["Type"]) ;
                 }
                 
                  
                  if(row["Advance"]!= DBNull.Value)
                  {
                  info.Advance=Convert.ToInt32(row["Advance"]);
                 }
                 
                  
                  if(row["Version"]!= DBNull.Value)
                  {
                  info.Version=row["Version"].ToString();
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, CalendarNotice info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@NoticeId", DbType.String,ParameterTool.GetObj( info._NoticeId )); 
            
             
                cn.AddInParameter(comm, "@DayId", DbType.String,ParameterTool.GetObj( info._DayId )); 
            
             
                cn.AddInParameter(comm, "@Type", DbType.Int32,ParameterTool.GetObj( info._Type )); 
            
             
                cn.AddInParameter(comm, "@Advance", DbType.Int32,ParameterTool.GetObj( info._Advance )); 
            
                
                cn.AddInParameter(comm,"@Version", DbType.String, Guid.NewGuid().ToString());
              

                cn.AddInParameter(comm,"@_versionOdl", DbType.String, info._Version); 
                 
        } 

    } 
} 